//
//  WebAPI.h
//  WeChatHelper
//
//  Created by bang yi bang on 14-3-20.
//  Copyright (c) 2014年 bang yi bang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SVProgressHUD.h"
#import "ConstansCode.h"
#import "AFHTTPRequestOperationManager.h"



//#define kUrl @"http://api.syinchung.com/api"

//#define kAdoptUrl @"http://dev.syinchung.com/survey"
//#define kAdoptUrl @"http:192.168.1.250/survey"

//#define kImgUrl @"http://api.syinchung.com/api/user/avatar"  //用户头像
//#define kPetUrl @"http://api.syinchung.com/api/user/petAvatar" //宠物头像
//===  发布领养信息的上传图片 ===
//#define kSendPetURL @"http://api.syinchung.com/api/user/adoptPhoto"
//@"http:192.168.1.250/api"



//#define kBaseURL @"http:192.168.1.250:81/"

#define kBaseURL @"http://www.123csm.com/"

#define kUrl [kBaseURL stringByAppendingFormat:@"%@",@"api"]
#define kAdoptUrl [kBaseURL stringByAppendingFormat:@"%@", @"survey"]

#define kImgUrl [kBaseURL stringByAppendingFormat:@"%@", @"api/user/avatar"] //用户头像
#define kPetUrl [kBaseURL stringByAppendingFormat:@"%@",@"api/user/petAvatar"]  //宠物头像
//===  发布领养信息的上传图片 ===
#define kSendPetURL [kBaseURL stringByAppendingFormat:@"%@",@"api/user/adoptPhoto"]

#define kPetPhotoURL [kBaseURL stringByAppendingFormat:@"%@",@"api/user/petPhoto"]

#define kHospitalURL [kBaseURL stringByAppendingFormat:@"%@",@"api/hospital/hospitalAvatar"]//医院头像


#define kHospitalMoble @"13751810582"//医院测试账号

#define petShareUrl(i) [NSString stringWithFormat:@"%@%@%@",@"http://api.syinchung.com/",@"pet/detail?petID=",i]

//#define kDetailsUrl @"http://www.syinchung.com/news/detail?newsID=%@"
#define kDetailsUrl [kBaseURL stringByAppendingFormat:@"%@",@"news/detail?newsID=%@"]

#define kCooperation [kBaseURL stringByAppendingFormat:@"%@", @"about/cooperation"]
#define kAdd @"http://www.taobao.com"

#import "CurrentDate.h"
#import "ConstansCode.h"

typedef void (^WebAPIBlockRequest)(NSInteger state,AFHTTPRequestOperation *operation, id responseObject);
typedef void (^UpdataImgAPIRequest)(NSInteger state, id responseObject ,NSString * filename);

@interface WebAPI : NSObject
{
    
    WebAPIBlockRequest _complete;
}
//@property (nonatomic , readonly) AFHTTPRequestOperationManager *manager;
// 实例
+ (WebAPI *) defaultManager;

+ (NSString *) getKeyForMd5WithType:(NSString *)type nodeName:(NSString *)nodeName p:(NSDictionary *)p;

//设置解析器
- (void) setResponseSerializer:(AFHTTPResponseSerializer *) serializer;

// 设置http header
- (void) setHeader:(NSString *)value forKey:(NSString *)key;

// post请求
- (void) postWebAPI:(NSDictionary *)params withPath:(NSString *)path andMethodNode:(NSString *)node completed:(WebAPIBlockRequest)complete;

// get请求
- (void) getWebAPIWithPath:(NSString *)path andParams:(NSDictionary *)params completed:(WebAPIBlockRequest)complete;
- (void) getWebAPIWithPath:(NSString *)path andParams:(NSDictionary *)params andMethodNode:(NSString *)node  completed:(WebAPIBlockRequest)complete;
- (void) getWebAPIWithParams:(NSDictionary *)params andMethodNode:(NSString *)node completed:(WebAPIBlockRequest)complete;

//登陆
- (void)logInWithUserName:(NSString *)name andPassword:(NSString *)password completed:(WebAPIBlockRequest)complete;

//屡次登录
-(void)loginIn:(NSString *)userName andPw:(NSString *)password;

//md5加密－－－－singe－－－－key
+ (void) webAPISignAddMd5tWithNote:(NSString *)note parm:(NSDictionary *)parm completed:(WebAPIBlockRequest)complete;

- (void)updateAimg:(UIImage *)image andView:(UIView *)view andisHeadPic:(BOOL)isHeadPic andParams:(NSDictionary *)params andUrlString:(NSString *)string andComplete:(UpdataImgAPIRequest)completeRequest ;

+(NSString *)getSignString;

#pragma mark-------上传多张图片
- (void)sendMultipleUIImage:(UIImage *)image andView:(UIView *)view andisHeadPic:(BOOL)isHeadPic andParams:(NSDictionary *)params andUrlString:(NSString *)string andDateKey:(NSString *)key andComplete:(UpdataImgAPIRequest)completeRequest;


//同步登陆
-(void)loginInWithMob:(NSString *)mob;
@end
